# # -*- coding:utf-8 -*-
# import redis, os, json
#
# import logging
#
# # Set the parameter of redis
# Redis_IP = os.getenv('REDIS_IP', '127.0.0.1')
# Redis_PORT = int(os.getenv('REDIS_PORT', 6379))
# Redis_DB = int(os.getenv('REDIS_DB', 6))
# Redis_expire_time = int(os.getenv('REDIS_EXPIRE_TIME', 3600 * 24))
#
#
# class RedisManager:
#     def __init__(self):
#         self.redis = redis.Redis(
#             host=Redis_IP,
#             port=Redis_PORT,
#             db=Redis_DB
#         )
#         self.expire_time = Redis_expire_time
#
#     def str_set(self, url, cTypeInfo):
#         if isinstance(cTypeInfo, dict):
#             cTypeInfo = json.dumps(cTypeInfo, ensure_ascii=False)
#
#         if self._exist_url(url=url):
#             self.redis.set(name=url, value=cTypeInfo, ex=self.expire_time)
#
#     def _exist_url(self, url):
#         return self.redis.exists(url)
#
#     def delete_url(self, url):
#         if self._exist_url(url):
#             self.redis.delete(url)
#
#     def str_get(self, url):
#         response = self.redis.get(url)
#         if response:
#             return self.redis.get(url).decode('utf-8')
#
#
# redis_manager = RedisManager()
